<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="{{asset('resources/views/admin/Flat/dist/css/vendor/bootstrap.min.css')}}" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="{{asset('resources/views/admin/Flat/dist/css/flat-ui.css')}}" rel="stylesheet">
	    <link href="{{asset('resources/views/admin/Flat/docs/assets/css/demo.css')}}" rel="stylesheet">
	    <link rel="shortcut icon" href="{{asset('resources/views/admin/Flat/img/favicon.ico')}}">

	    <!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
	    <!--[if lt IE 9]>
	      <script src="{{asset('resources/views/admin/dist/js/vendor/html5shiv.js')}}"></script>
	      <script src="{{asset('resources/views/admin/dist/js/vendor/respond.min.js')}}"></script>
		  <script src="{{asset('resources/org/layer/layer.js')}}"></script>
	    <![endif]-->
		<script src="{{asset('resources/views/admin/assets/global/plugins/jquery.min.js')}}" type="text/javascript"></script>
		<script src="{{asset('resources/org/layer/layer.js')}}"></script>
		<script>
			$(function () {
				$('.btn-danger').click(function () {
					var $ctid = $(this).attr('ctid');
						delcity($ctid)
				})


				function delcity($ctid) {
					//询问框

					layer.confirm('确定删除这个城市吗？', {
						btn: ['确定','取消'] //按钮
					}, function(){
						$.post("{{url('admin/city/')}}/"+$ctid,{'_method':'delete','_token':"{{csrf_token()}}"},function (data) {
							if(data.status == 0){
								location.href = location.href;
								layer.msg(data.msg,{icon:6});

							}else{
								layer.msg(data.msg,{icon:5});
							}
						})

						//layer.msg('的确很重要', {icon: 1});
					}, function(){


//						layer.msg('也可以这样', {
//							time: 20000, //20s后自动关闭
//							btn: ['明白了', '知道了']
//						});
					});




				}


			})
		</script>
	</head>
	<body>
		<table class="table table-hover">
			<tr class="active">
			  <th width="30">tid</th>
			  <th>城市名</th>
			  <th width="200">操作</th>
			</tr>
			@foreach($data as $v)
			<tr>
				<td>{{$v->ctid}}</td>
				<td>{{$v->cityname}}</td>
				<td>
					<a href="{{url('admin/city/'.$v->ctid.'/edit')}}" class="btn btn-sm btn-warning">编辑</a>
					<a href="javascript:;" ctid ="{{$v->ctid}}" class="btn btn-sm btn-danger" >删除</a>
				</td>
			</tr>
			@endforeach
		</table>
	</body>
</html>
